#include "rectangle.h"

/*
 * Constructors & destructor
 */

Rectangle::Rectangle() : Pair() {}

Rectangle::Rectangle(int width, int height) : Pair(width, height) {}

Rectangle::Rectangle(const Rectangle &other) : Pair(other) {}

Rectangle::~Rectangle() {}

/*
 * Setters & getters
 */

void Rectangle::setWidth(int w) {
    this->Pair::setLeft(w);
}

void Rectangle::setHeight(int h) {
    this->Pair::setRight(h);
}

int Rectangle::getWidth() {
    return this->Pair::getLeft();
}

int Rectangle::getHeight() {
    return this->Pair::getRight();
}

/*
 * Overloads
 */

std::ostream & operator<<(std::ostream &os, const Rectangle &rect) {
    os << "width: " << rect.Pair::getLeft() << ", height: " << rect.Pair::getRight();
    return os;
}

/*
 * Public methods (interface)
 */

int Rectangle::area() {
    return this->Pair::mul();
}

int Rectangle::perimeter() {
    return 2 * (this->Pair::getLeft() + this->Pair::getRight());
}
